# build stage
FROM node-env as build-stage
RUN node -v \
    && npm -v
WORKDIR /app
COPY package*.json ./
COPY *-lock.json ./
RUN npm config get registry \
    && pnpm install
COPY . .
RUN npm run build

FROM nginx as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY --from=build-stage /app/script/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
